package com.lagou.controller;

import com.lagou.service.EmailService;
import com.lagou.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RefreshScope
public class EmailController {
    @Autowired
    private EmailService emailService;

    @GetMapping("/email/{email}/{code}")
    @ResponseBody
    public boolean sendCode(@PathVariable String email, @PathVariable String code) {

        boolean result = emailService.sendEmail(email, code);

        return result;
    }

}
